The electromagnets of this kind for solenoid valves include an electromagnet shown in FIG. 19. Referring to FIG. 19, a valve body B' is attached to a base frame of a machine, for example, a machine tool. An electromagnet A' is fastened to the valve body B' with setting bolts 50' with the electromagnet A' and valve body B' facing each other in a corresponding condition (for example, in such a condition that the positions of plug pins 54 correspond to those of receptacles 54' in the valve body B'). Since the valve body B' is designed in accordance with an object machine, the direction in which the valve body B' attached to a base frame of the machine faces varies. Accordingly, it is possible that the electromagnet A' is fastened to the valve body B' with any of first, second and third surfaces 51, 52, 53 thereof facing in the upward direction. In order that air can be released no matter whichever surface of the electromagnet A' fastened to the valve body B' faces in the upward direction, air vent holes 41' in which packing-carrying plugs 42' are fitted are provided in the portions of a cap E' for the electromagnet A' which correspond to these surfaces 51, 52, 53 respectively.
In this conventional structure, at least three air vent holes 41' mentioned above are required. However, providing a plurality of such air holes in which packing-carrying plugs are fitted costs a great deal to cause the cost of manufacturing an electromagnet for solenoid valves to increase.